Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only apply limit disclosure for matching vcs #168

Conversation

TimoGlastra
Copy link
Contributor

When you have a presentation definition with multiple input descriptors, and multiple VCs, it tries to apply the limit disclosure to all VCs. This means that claims are not disclosed that do need to be disclosed.

This PR updates the limit disclosure handler to only apply limit disclosure based on constraints in an input descriptor if the VC matches the requirements of the input descriptor.

It also handles an advance case, where if one VC matches multiple input descriptors. This is handled by combining the constraints and disclosing both requirements. If you only use the VC for one input descriptor in the end it means you disclose some attribute that are not needed, but as this is already an advanced case I think this is fine for now (we at least disclose what is needed). With the current API it would be very hard to fix this, as we need to have a mapping of input descriptor -> disclosed VC. And then maybe just include the same VC twice with different disclosures. But for now I think this already fixes the main bug.

@TimoGlastra
Copy link
Contributor Author

Another one @sanderPostma / @ksadjad :)

We're just now basically starting to explore multi-vp / multi-cred exchanges, and that results in some edge cases being hit

import PexMessages from '../../types/Messages';
import { applySdJwtLimitDisclosure, JsonPathUtils } from '../../utils';
import { EvaluationClient } from '../evaluationClient';

import { AbstractEvaluationHandler } from './abstractEvaluationHandler';
import { elligibleInputDescriptorsForWrappedVc } from './markForSubmissionEvaluationHandler';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"elligible" is consistently misspelled
-> eligible

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will rename it

@sanderPostma sanderPostma merged commit ca2387e into Sphereon-Opensource:develop Sep 18, 2024
1 check failed
@TimoGlastra
Copy link
Contributor Author

Hey @sanderPostma, has this been released as an unstable release of PEX? It seems the latest (unstable 7) doesn't include this fix yet

@sanderPostma
Copy link
Contributor

Hi @TimoGlastra
After merging in your PR for PEX and OID4VC, tests in other libraries started failing.
There were issues in evaluationClientWrapper.ts, evaluatePresentations & extractWrappedVcFromWrappedVp
It had to do with the fact that vpResults.value could return both a single item or an array and doing a vp.format === on an array is not going to work.

Sadjad started doing some fixes, but to make the lib work for singleton or one-element-array VPs I have made an emergency release from another branch (develop-20240918) so we could build our other repos again, but the multi-vp tests are failing in that one.
Some of the earlier .unstable releases like 2 or 3 have your changes still in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants